package cn.green.busi.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/busi")
public class BusinessController {

    @GetMapping("/doA")
    public String doBusinessA() {
        return "资源a";
    }

    @GetMapping("/doB")
    public String doBusinessB() {
        return "资源b";
    }

    @RequestMapping("/getUserInfo")
    public Object whoIm(){
        return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }

}
